﻿/* Copyright © Hauer Engineering 2012 */

(function ($)
{
    var methods =
        {
            send: function (options)
            {
                if (!options)
                    $.error('options are null or undefined');

                var defaultOptions =
                    {
                        text: null,
                        type: $.heng.messageType.Error,
                        scope: $.heng.messageScope.Global
                    };

                if (!options.text)
                    $.error('message text is null or undefined.');

                $.extend(true, defaultOptions, options);

                alert('Text: ' + defaultOptions.text + ' Type: ' + defaultOptions.type + ' Scope: ' + defaultOptions.scope);
            }
        };

    $.setupNamespace('heng');

    $.heng.messaging = function (method)
    {
        if (methods[method])
        {
            return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
        }
        else
        {
            $.error('Method ' + method + ' does not exist on jQuery.heng.messaging');
        }
    };

    $.heng.messageType =
    {
        Error: 'Error',
        Warning: 'Warning',
        Info: 'Info'
    };

    $.heng.messageScope =
        {
            Global: 'Global'
        };
})(jQuery);